package com.wxm.jwt.service.properties;

import com.wxm.jwt.client.properties.JWTAuthClient;
import com.wxm.jwt.exception.JWTException;
import com.wxm.jwt.util.FileUtils;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;

/**
 * <p>
 *      客户端jwt 文件配置读取公钥
 * </p>
 *
 * @author: wxm
 * @Date: 2021/10/6
 */
@Data
@AllArgsConstructor
public class JWTFileAuthService implements JWTAuthService {
    private File pubFile;
    private File priFile;
    private int second;


    @Override
    public byte[] getAuthServicePubKey() {
        return FileUtils.getFileByteArray(this.pubFile);
    }

    @Override
    public byte[] getAuthServicePriKey() {
        return FileUtils.getFileByteArray(this.priFile);
    }

    @Override
    public int getExpireSecond() {
        return this.second;
    }
}
